import os
import subprocess
import unittest
import uiautomation
from config.config import DATA_PATH
from page.登录.login_page import Login
from tools.sjqd_way import read_data_from_excel
class TestLogin(unittest.TestCase):
    def test_login(self):
        self.data = read_data_from_excel(os.path.join(DATA_PATH, "datas.xls"), "登录")
        name, password, location = self.data[0]
        print(location)
        subprocess.Popen(location) #启动程序
        his = uiautomation.WindowControl(searchDepth=1, Name='科玛奇医院信息管理系统')  #锁定窗口
        his.SetFocus()
        his.SetTopmost()
        ap = Login()
        ap.Login(name,password)
if __name__ == '__main__':
    unittest.main()